<!DOCTYPE html>
<body>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<style>
iframe {
    margin-top: 200px;
    margin-left: 400px;
}
</style>
<div id="log"></div>
<iframe srcdoc="<div style='height:400px;'></div><select><option>Option 1</option></select>"></iframe>
<script>
window.onload = function() {
    test(function() {
        var select = document.querySelector('iframe').contentDocument.querySelector('select');
        select.focus();
        // Scroll out the |select|.
        select.ownerDocument.scrollingElement.scrollTop = 0;
        // Try to open a popup.
        eventSender.keyDown(' ');
        assert_false(internals.isSelectPopupVisible(select));
    }, 'SELECT element should not open a popup menu if it\'s not in the viewport.');
};
</script>
</body>
